ls=[{'性别':'女','书本':10,'文具':30,'服饰':300,'零食':150,'日用品':600},
    {'性别':'女','书本':200,'文具':10,'服饰':300,'零食':300,'日用品':100},
    {'性别':'男','书本':200,'文具':100,'服饰':1000,'零食':100,'日用品':200},
    {'性别':'男','书本':50,'文具':20,'服饰':300,'零食':150,'日用品':600},
    {'性别':'男','书本':200,'文具':50,'服饰':400,'零食':100,'日用品':200},
    {'性别':'女','书本':100,'文具':10,'服饰':500,'零食':150,'日用品':800},
    {'性别':'女','书本':200,'文具':100,'服饰':500,'零食':300,'日用品':200},
    {'性别':'男','书本':300,'文具':50,'服饰':0,'零食':10,'日用品':50},
    {'性别':'男','书本':100,'文具':10,'服饰':500,'零食':40,'日用品':500},
    {'性别':'男','书本':200,'文具':50,'服饰':200,'零食':100,'日用品':100}]
#统计每一类消费的平均消费金额
total={}
for dic in ls:
    for k,v in dic.items():
        if k!='性别':
            total[k]=total.get(k,0)+v

print('每一类的消费标准如下所示：')
for key in total.keys():
    print(key,end='\t')
print()
for value in total.values():
    print(value/len(ls),end='\t')
#分别统计男，女双十一的平均消费金额
dicAvg={}
dicCnt={}
for dic in ls:
    s=0
    for k,v in dic.items():
        if k!='性别':
            s=s+v
    dicAvg[dic['性别']]=dicAvg.get(dic['性别'],0)+s
    dicCnt[dic['性别']]=dicCnt.get(dic['性别'],0)+1
for sex in ['男','女']:
    dicAvg[sex] /= dicCnt[sex]
print('\n男，女双十一的平均消费总金额是：')
print(dicAvg)
